﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace OF.Web
{
    public class EncryptUtil
    {
        /// <summary>
        /// 加密
        /// </summary>
        public static string Encrypt(string str)
        {
            byte[] bytes = Encoding.UTF8.GetBytes(str);
            string encStr= Convert.ToBase64String(bytes);
            char[] chars = encStr.ToCharArray();
            Array.Reverse(chars);
            string newStr = new string(chars);
            return newStr;
        }

        /// <summary>
        /// 解密
        /// </summary>
        public static string Decrypt(string str)
        {
            char[] chars = str.ToCharArray();
            Array.Reverse(chars);
            string newStr = new string(chars);
            byte[] outputb = Convert.FromBase64String(newStr);
            string orgStr = Encoding.UTF8.GetString(outputb);
            return orgStr;
        }
    }
}
